﻿using AopTest2.Middleware;
using Autofac;
using Autofac.Extras.DynamicProxy;
using BaseService;
using IBaseService;
namespace AopTest2
{
    public class AutoModel:Autofac.Module
    {
        protected override void Load(ContainerBuilder builder)
        {


            builder.RegisterType<AopCacheIntercept>();

            //注册services
            builder.RegisterType<TimeService>().As<ITimeService>().InstancePerLifetimeScope()
                .InterceptedBy(typeof(AopCacheIntercept))
                .EnableInterfaceInterceptors();
            

        }

    }
}
